package work_b;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.function.Consumer;

public class Collection_test {
    public static void main(String[] args) {
        ArrayList<Integer> number = new ArrayList<>();
        number.add(12);
        number.add(37);
        number.add(35);
        number.add(2);
        number.add(82);
        number.add(42);
        Collections.shuffle(number);//打乱排序
        System.out.println(number);
        Collections.sort(number);//升序
        System.out.println(number);
        //降序
        Collections.sort(number  ,new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {

                return o2 - o1;
            }
        });
        System.out.println(number);

    }
}